import Vue from 'vue'
import Router from 'vue-router'
// import Index from 'views/Index'

Vue.use(Router)

export default new Router({
	mode: 'history',
	base: process.env.IS_LOCAL ? '' : '/app/',
	scrollBehavior (to, from, savedPosition) {
		// console.log('savedPosition', savedPosition)
		if (savedPosition) {
			return savedPosition
		} else {
			if (from.meta.savedScrollTop) {
				from.meta.savedPosition = document.documentElement.scrollTop || document.body.scrollTop
			}
			return { x: 0, y: 0 }
		}
	},
	routes: [
		{
			path: '',
			component: () => import('_views/Home'),
			name: 'Home'
		},
		{
			path: '/SetDebug',
			component: () => import('_views/SetDebug'),
			name: 'SetDebug'
		},
		{
			path: '/UserBus', // 用户业务详情
			component: () => import('_views/UserBus'),
			name: 'UserBus'
		},
		{
			path: '/Login', // 登录页面
			component: () => import('_views/Login'),
			name: 'Login',
			meta: {
				title: ''
			}
		},
		{
			path: '/Pay', // 支付页面
			component: () => import('_views/Pay'),
			name: 'Pay'
		},
		{
			path: '/MemberBusList', // 业务人员列表
			component: () => import('_views/MemberBusList'),
			name: 'MemberBusList'
		},
		{
			path: '/MembelListWechat', // 微信群成员列表
			component: () => import('_views/MembelListWechat'),
			name: 'MembelListWechat'
		},
		{
			path: '/BusCardListSelect', // 名片列表
			component: () => import('_views/BusCardListSelect'),
			name: 'BusCardListSelect'
		},
		{
			path: '/WriteBusCard', // 微信群成员列表
			component: () => import('_views/WriteBusCard'),
			name: 'WriteBusCard'
		},
		{
			path: '/AsMemberList', // 社群成员列表
			component: () => import('_views/AsMemberList'),
			name: 'AsMemberList'
		},
		{
			path: '/Profile', // 个人中心页面
			component: () => import('_views/Profile'),
			name: 'Profile'
		},
		{
			path: '/UserIndex', // 个人主页页面
			component: () => import('_views/UserIndex'),
			name: 'UserIndex'
		},
		{
			path: '/SetUser', // 设置用户信息页面
			component: () => import('_views/SetUser'),
			name: 'SetUser'
		},
		{
			path: '/About', // 关于页面
			component: () => import('_views/About'),
			name: 'About'
		},
		{
			path: '/Test', // 测试页面
			component: () => import('_views/Test'),
			name: 'Test'
		},
		{
			path: '*',
			component: () => import('_views/404'),
			name: '404'
		}
	]
})
